-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(profiler): no such file /proc/{pid}/task #117
Conversation
✅ Deploy Preview for flashlight-docs canceled.
|
e247f70
to
89fc8cf
Compare
Flashlight Automated Report 🔦 |
4085dcd
to
dae63fa
Compare
Flashlight Automated Report 🔦 |
Flashlight Automated Report 🔦 |
Flashlight Automated Report 🔦 |
Flashlight Automated Report 🔦 |
Pid can change if app is restarted in the background
Flashlight Automated Report 🔦 |
@@ -10,7 +12,7 @@ const mockSpawn = (): { stdout: EventEmitter; kill: () => void } => { | |||
.spyOn(require("child_process"), "spawn") | |||
.mockImplementationOnce((...args) => { | |||
expect(args).toEqual(["adb", ["shell", "atrace", "-c", "view", "-t", "999"]]); | |||
return mockProcess; | |||
return mockProcess as ChildProcess; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we okay with these casts I suppose ?
@@ -1,4 +1,6 @@ | |||
/* eslint-disable @typescript-eslint/no-var-requires */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes (but at least it's in a test file)
.spyOn(require("child_process"), "spawn") | ||
.mockImplementationOnce((...args) => { | ||
expect(args).toEqual(["adb", ["shell", "atrace", "-c", "view", "-t", "999"]]); | ||
return aTraceMock as ChildProcess; | ||
return aTraceMock; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah well i was wondering why the extra cast on the previous commit haha
process.stderr?.on("data", (data) => { | ||
const log = data.toString(); | ||
|
||
// Ignore errors, it might be that the thread is dead and we can read stats anymore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't ?
Flashlight Automated Report 🔦 |
* fix(profiler): ensure failure if profiling script fails * docs(cpp): update docs to run c++ profiler * refactor(cpp): move logic to function * chore(cpp): throw custom error if directory not found * refactor: move some test utils to e2e folder * refactor(test): separate between atrace mock and profiler mock * refactor(test): fix some typings * refactor(profiler): add logStderr option * refactor(profiler): pass errors on stderr instead of stdout * fix(profiler): reset measures if pid changes Pid can change if app is restarted in the background * chore(cpp): recompile executables * fix(profiler): ensure graceful kill doesn't throw error * chore: fix comment
Tested with APKPure apk and this command:
test.yaml
isWith current
flashlight test
command it used to show an error "no such file /proc/{pid}/task" in CLI and then actual measures of the app opened were lostWhat was happening was:
flashlight test
maestro
restarted the app with a new pidNow: